package auctionhaus

import java.util.Date;
import java.util.List;

class Listing {

	String name;
	Date endDateTime;
	Float startingPrice;
	String description;
	List bids //for ordering
	static hasMany = [bids:Bid]
	static hasOne = [winner: Customer]
	static belongsTo = [seller: Customer]
	Date dateCreated;
	

	static constraints = {
		description(nullable:true, size:1..255)
		name(blank: false, size:1..63)
		endDateTime(nullable: false,
				validator: {val, obj ->
					val > new Date()
				})


		winner(nullable:true)
		startingPrice(min: 0F, scale:2)

	}
	
	public String toString(){
		return name;
	}
}
